#coding=utf-8
import os
import random

pingaddr = ["www.baidu.com",
            "www.qq.com",
            "www.1688.com",
            "www.taobao.com"]
def systemNetStatusProcess():
    ranPingAddr = random.choice(pingaddr)
    #print ranPingAddr

    pingShell = 'ping '+str(ranPingAddr)+' -c 3'

    result = os.system(pingShell)

    print 'ping result:',result
    if result != 0:#网络断开
        restartNetShell = '/etc/init.d/networking restart'
        os.system(restartNetShell)

